
	<!DOCTYPE html>
	<html>
		<head>
			<meta charset="UTF-8">
			<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
			<title>质检列表</title>
			<link rel="stylesheet" href="css/AllStyle.css" />
			<link rel="stylesheet" href="css/iconfont.css" />
			<script type="text/javascript" src="js/common.js" ></script>
			<script type="text/javascript" src="js/companydata.js" ></script>
<!--			  <script type="text/javascript" src="js/loadData.js" ></script>-->
			<script type="text/javascript" src="js/data.js" ></script>
			<script type="text/javascript" src="js/tmpl.js" ></script>
		</head>
		<body>
			<!-- 页头 -->
			<section>
				<script type="text/javascript">
					AllPageHeader()
				</script>
			</section>

			<section class="AllContent" id="AllContent" style="background-color: #fff;">

					<form>
						<div class="FormStyle">
							<div class="ScanInput" style="width:90%;margin:10px auto;">
								<p style="margin: 0px;"><input name="reportNo" id="reportNo" class="bg-focus form-control" type="text" placeholder="工程名称,工序名称,质检编号"></p>
								<p style="margin: 0px;"><button type="button" style="font-size:0.9em" onclick="querySend();">查询</button></p>
							</div>
							<p class="TheResults" style="margin:0px 5%;padding:0px;padding-bottom:10px;"></p>
							<div class=""><p class="relative alert alert-success"></p></div>
						</div>

						<div class="grid-body" id="cententbody"></div>
					</form>

				<div id="sendList" style="background-color: #fff;">
					<img style="width: 40%;margin:20px auto;display: block;" src="images/loading5.gif">
				</div>

			</section>

			<div id="dddd"></div>
		</body>
		<script type="text/javascript" src="js/jquery.min.js" ></script>
		<script type="text/javascript" src="js/mui.min.js" ></script>
		<script type="text/javascript" src="js/mui.pullToRefresh.js"></script>
		<script type="text/javascript" src="js/mui.pullToRefresh.material.js"></script>
		<script type="text/javascript">
			let pageNo = 1;
			let totalPages = 1;


			mui.init();


			$('.AllHeader li:eq(1)').text("质检列表");
			$('.AllHeader li:eq(2)').html('<img style="width:28px" src="images/Scan.png">')

			mui.plusReady(function(){
				//扫描器
				document.getElementById('Scanner').addEventListener('tap', function() {
				  mui.openWindow({
					url: 'Scanner.html?etk=3',
					id:'Scanner.html'
				  });
				});
			});

			//添加refresh自定义事件监听
			window.addEventListener('qualityList',function(){
				var id = event.detail.id;
				$('#reportNo').val(id);
				querySend();
			});

			mui.back = function() {
			    mui.openWindow({
			    	url: 'supper.html',
			    	id:'supper.html'
			    });
			}

			//搜索客户发货单
			$(".serarchBtn").on('tap',function(){
			  querySend();
			});

			$(function(){
				if(getCookie("token") === null || getCookie("token") === ''){
					window.location.href='login.html';
					return;
				}
				mui('#sendList').pullToRefresh({
					down: {
						callback: function() {
							var self = this;
							pageNo = 1;
							querySend(self);
						}
					},
					up: {
						callback: function() {
							var self = this;
							pageNo = pageNo + 1;
							setTimeout(function() {
								if(pageNo <= totalPages){
									querySend();
									self.endPullupToRefresh();
								}
							}, 100);
						}
					}
				});
				querySend();
			});

			function querySend(objList) {
				var reportNo = $("#reportNo").val();
				var myData = {'pageSize':5,'pageNo':pageNo};
				if(reportNo !== undefined && reportNo !== ''){
					myData = {'reportNo':reportNo,'pageSize':5,'pageNo':pageNo};
				}
				var product = false;
				let appendHtml = '';
				let loaded = false;
				$.ajax({
					headers:{
						"X-Access-Token":getCookie("token")
					},
					type: "GET",
					url: getServerUrl()+"/quality/qualityTesting/reportList", //与此php页
					dataType: 'json', //从php返回的值以 JSON方式 解释
					contentType: 'application/json',
					data: myData,
					success: function (json) {
						if(loaded){
							return;
						}
						sendlist = json.result.records;
						var chtml = '';
						if (!empty(sendlist)) {
							for (var i = 0; i < sendlist.length; i++) {
								if (!empty(sendlist[i])) {
									chtml = chtml + '<a href="quality.html?id='+sendlist[i].id+'' +
											'&reportNo=' + sendlist[i].reportNo +
											'&reportCount=' + sendlist[i].reportCount +
											'&inProcCount=' + sendlist[i].inProcCount +
											'&qualifiedCount=' + sendlist[i].qualifiedCount +
											'&noQualifiedCount=' + sendlist[i].noQualifiedCount +
											'&procName=' + sendlist[i].procName +
											'&engineName=' + sendlist[i].engineName +
											'&realName=' + sendlist[i].realName +
											'&reportTime=' + sendlist[i].reportTime +
											'&framCount=' + sendlist[i].framCount +
											'&status=' + sendlist[i].status +
											'">';
									chtml = chtml + '<div class="ProductsListContent">';
									chtml = chtml + '<div class="ProductsDetails">';
									chtml = chtml + '<p>工程名称：' + sendlist[i].engineName + '</p>';
									chtml = chtml + '<p>工序名称：' + sendlist[i].procName + '</p>';
									chtml = chtml + '<p>报工单号：' + sendlist[i].reportNo + '</p>';
									chtml = chtml + '<p>报工时间：' + sendlist[i].reportTime + '</p>';
									chtml = chtml + '<p>报工数量：' + sendlist[i].reportCount + '</p>';
									chtml = chtml + '<p>在制数量：' + sendlist[i].inProcCount + '</p>';
									chtml = chtml + '<p>已检数量：' + sendlist[i].qualifiedCount + '</p>';
									chtml = chtml + '<span style="width: 100%;padding-top:10px;height:40px;margin-top:10px;background-color:#00a9ed;float:left;color:#ffffff;text-align:center;font-size:20px;">质检</span>';
									chtml = chtml + '</li>';
									chtml = chtml + '</ul>';
									chtml = chtml + '</div>';
									chtml = chtml + '</div>';
									chtml = chtml + '</a>';
								}
							}
						}
						if(pageNo === 1){
							$("#sendList").html(chtml);
						}else{
							$("#sendList").append(chtml);
						}
						pageNo = json.result.current;
						totalPages = json.result.pages;
						loaded = true;
					},
					error: function () {
					}
				});
				var oTxt=document.getElementById("reportNo");
				oTxt.value="";
			}
		</script>
		<style>
			p{
				margin-top: 10px;
			}

			.mui-bar~.mui-content .mui-fullscreen {
				top: 44px;
				height: auto;
			}
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: 40px;
				height: 40px;
				border-radius: 100%;
				z-index: 1;
			}
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			.mui-pull-top-wrapper {
				width: 42px;
				height: 42px;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			.mui-pull-top-tips .mui-pull-loading {
				/*-webkit-backface-visibility: hidden;
				-webkit-transition-duration: 400ms;
				transition-duration: 400ms;*/
				margin: 0;
			}
			.mui-pull-top-wrapper .mui-icon,
			.mui-pull-top-wrapper .mui-spinner {
				margin-top: 7px;
			}
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height: 40px;
				color: #777;
			}
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: 40px;
				height: 40px;
				margin: 0 auto;
			}
			.mui-pull-top-canvas canvas {
				width: 40px;
			}
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
		</style>
	</html>
